#include "debug.h"
#include "../DDIC/AllDDIC.h"
#include "usbd_cdc.h"
#include"OuadSPI.h"


u8 NT37350_bufferR[54];
u8 NT37350_bufferG[54];
u8 NT37350_bufferB[54];
void NT37350_Read_Gamma(USBD_HandleTypeDef *pdev,uint8_t  ep_addr,u8 SigMode ,u8 channel,u8* buffer,u16 LP_B7_Data,u16 HS_B7_Data)
{
			u8 buffer1[7];
			u16 tmp;
			u8 tempRec[16];
			u8 i,j;
			if(SigMode==Video_Mode||SigMode==CMD_Mode)
			{
		   SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data);
			 buffer1[0] = 0x02;        
    	 buffer1[1] = 0xff;
				buffer1[2] = 0x21;
	     delay_ms(15);	
			  SSD2828_W_Array(SigMode,channel,buffer1,0); 
			 delay_ms(5);	
			
//					SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data|0x0080);
//					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
//	        delay_ms(2);				 
//		      buffer1[0] = 0x02;        
//					buffer1[1] = 0xCC; 
//					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
//					delay_ms(2);                
//					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
//					SSD2828_W_Cmd(SigMode,channel,0xFF);
//					delay_ms(2);
//					for(i=0;i<16;i++)
//					{
//						SSD2828_W_Cmd(SigMode,channel,0xFA);
//						tmp=SPI3_Read_u16_Data(channel);
//						NT37350_bufferR[i]=tmp>>8;
//						NT37350_bufferR[1+i]=tmp;
//						delay_ms(5);
//						i++;		
//					}	
//			   buffer[0]=0x72;	//NT37350
//    buffer[1]=0x09;
//		buffer[2]=0x10;
//		
//		delay_ms(15);
//    STM2PC(pdev,CDC_IN_EP,buffer,buffer[2]+3);          //返回 读取的 Gamma数据  ：ok  		
//    SSD2828_W_Reg(SigMode,channel,0xB7,HS_B7_Data);
//}
    if((buffer[3]&0x10)==0x10)
			{
      if((buffer[3])==0x11)	   //gamma1
				{//R
					SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data|0x0080);
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xB2; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferR[i]=tmp>>8;
    					NT37350_bufferR[1+i]=tmp;
							delay_ms(5);
							i++;			
					}		
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xB3; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferR[i+16]=tmp>>8;
    					NT37350_bufferR[1+i+16]=tmp;
							delay_ms(5);
							i++;			
					}		
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xB4; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
								tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferR[i+32]=tmp>>8;
    					NT37350_bufferR[1+i+32]=tmp;
							delay_ms(5);
							i++;			
					}	
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0006); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xB5; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<6;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
								tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferR[i+48]=tmp>>8;
    					NT37350_bufferR[1+i+48]=tmp;
							delay_ms(5);
							i++;			
					}	
					
					//G
					SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data|0x0080);
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xB6; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferG[i]=tmp>>8;
    					NT37350_bufferG[1+i]=tmp;
							delay_ms(5);
							i++;			
					}		
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xB7; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferG[16+i]=tmp>>8;
    					NT37350_bufferG[1+i+16]=tmp;
							delay_ms(5);
							i++;			
					}		
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xB8; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferG[i+32]=tmp>>8;
    					NT37350_bufferG[1+i+32]=tmp;
							delay_ms(5);
							i++;			
					}	
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0006); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xB9; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<6;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
						tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferG[i+48]=tmp>>8;
    					NT37350_bufferG[1+i+48]=tmp;
							delay_ms(5);
							i++;			
					}	
					//B
					SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data|0x0080);
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xBA; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
					    tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferB[i]=tmp>>8;
    					NT37350_bufferB[1+i]=tmp;
							delay_ms(5);
							i++;			
					}		
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xBB; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferB[i+16]=tmp>>8;
    					NT37350_bufferB[1+i+16]=tmp;
							delay_ms(5);
							i++;			
					}		
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xBC; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferB[i+32]=tmp>>8;
    					NT37350_bufferB[1+i+32]=tmp;
							delay_ms(5);
							i++;			
					}	
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0006); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xBD; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<6;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferB[i+48]=tmp>>8;
    					NT37350_bufferB[1+i+48]=tmp;
							delay_ms(5);
							i++;			
					}	
					
				}

			else if((buffer[3])==0x12)	   //gamma2
				{//R
					SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data|0x0080);
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xBF; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferR[i]=tmp>>8;
    					NT37350_bufferR[1+i]=tmp;
							delay_ms(5);
							i++;			
					}		
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xC0; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferR[i+16]=tmp>>8;
    					NT37350_bufferR[1+i+16]=tmp;
							delay_ms(5);
							i++;			
					}		
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xC1; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
								tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferR[i+32]=tmp>>8;
    					NT37350_bufferR[1+i+32]=tmp;
							delay_ms(5);
							i++;			
					}	
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0006); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xC2; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<6;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
								tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferR[i+48]=tmp>>8;
    					NT37350_bufferR[1+i+48]=tmp;
							delay_ms(5);
							i++;			
					}	
					
					//G
					SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data|0x0080);
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xC3; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferG[i]=tmp>>8;
    					NT37350_bufferG[1+i]=tmp;
							delay_ms(5);
							i++;			
					}		
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xC4; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferG[16+i]=tmp>>8;
    					NT37350_bufferG[1+i+16]=tmp;
							delay_ms(5);
							i++;			
					}		
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xC5; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferG[i+32]=tmp>>8;
    					NT37350_bufferG[1+i+32]=tmp;
							delay_ms(5);
							i++;			
					}	
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0006); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xC6; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<6;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
						tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferG[i+48]=tmp>>8;
    					NT37350_bufferG[1+i+48]=tmp;
							delay_ms(5);
							i++;			
					}	
					//B
					SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data|0x0080);
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xC7; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
					    tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferB[i]=tmp>>8;
    					NT37350_bufferB[1+i]=tmp;
							delay_ms(5);
							i++;			
					}		
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xC8; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferB[i+16]=tmp>>8;
    					NT37350_bufferB[1+i+16]=tmp;
							delay_ms(5);
							i++;			
					}		
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xC9; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferB[i+32]=tmp>>8;
    					NT37350_bufferB[1+i+32]=tmp;
							delay_ms(5);
							i++;			
					}	
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0006); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xCA; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<6;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferB[i+48]=tmp>>8;
    					NT37350_bufferB[1+i+48]=tmp;
							delay_ms(5);
							i++;			
					}	
					
				}
			

      else if((buffer[3])==0x13)	   //gamma3
				{//R
					SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data|0x0080);
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xCC; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferR[i]=tmp>>8;
    					NT37350_bufferR[1+i]=tmp;
							delay_ms(5);
							i++;			
					}		
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xCD; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferR[i+16]=tmp>>8;
    					NT37350_bufferR[1+i+16]=tmp;
							delay_ms(5);
							i++;			
					}		
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xCE; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
								tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferR[i+32]=tmp>>8;
    					NT37350_bufferR[1+i+32]=tmp;
							delay_ms(5);
							i++;			
					}	
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0006); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xCF; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<6;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
								tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferR[i+48]=tmp>>8;
    					NT37350_bufferR[1+i+48]=tmp;
							delay_ms(5);
							i++;			
					}	
					
					//G
					SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data|0x0080);
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xD0; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferG[i]=tmp>>8;
    					NT37350_bufferG[1+i]=tmp;
							delay_ms(5);
							i++;			
					}		
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xD1; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferG[16+i]=tmp>>8;
    					NT37350_bufferG[1+i+16]=tmp;
							delay_ms(5);
							i++;			
					}		
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xD2; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferG[i+32]=tmp>>8;
    					NT37350_bufferG[1+i+32]=tmp;
							delay_ms(5);
							i++;			
					}	
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0006); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xD3; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<6;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
						tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferG[i+48]=tmp>>8;
    					NT37350_bufferG[1+i+48]=tmp;
							delay_ms(5);
							i++;			
					}	
					//B
					SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data|0x0080);
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xD4; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
					    tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferB[i]=tmp>>8;
    					NT37350_bufferB[1+i]=tmp;
							delay_ms(5);
							i++;			
					}		
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xD5; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferB[i+16]=tmp>>8;
    					NT37350_bufferB[1+i+16]=tmp;
							delay_ms(5);
							i++;			
					}		
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xD6; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferB[i+32]=tmp>>8;
    					NT37350_bufferB[1+i+32]=tmp;
							delay_ms(5);
							i++;			
					}	
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0006); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xD7; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<6;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferB[i+48]=tmp>>8;
    					NT37350_bufferB[1+i+48]=tmp;
							delay_ms(5);
							i++;			
					}	
					
				}
		  else if((buffer[3])==0x14)	  //HBM
				{
					//R
					SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data|0x0080);
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xDA; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferR[i]=tmp>>8;
    					NT37350_bufferR[1+i]=tmp;
							delay_ms(5);
							i++;			
					}		
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xDB; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferR[i+16]=tmp>>8;
    					NT37350_bufferR[1+i+16]=tmp;
							delay_ms(5);
							i++;			
					}		
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xDC; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
								tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferR[i+32]=tmp>>8;
    					NT37350_bufferR[1+i+32]=tmp;
							delay_ms(5);
							i++;			
					}	
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0006); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xDD; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<6;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
								tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferR[i+48]=tmp>>8;
    					NT37350_bufferR[1+i+48]=tmp;
							delay_ms(5);
							i++;			
					}	
					
					//G
					SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data|0x0080);
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xDE; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferG[i]=tmp>>8;
    					NT37350_bufferG[1+i]=tmp;
							delay_ms(5);
							i++;			
					}		
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xDF; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferG[16+i]=tmp>>8;
    					NT37350_bufferG[1+i+16]=tmp;
							delay_ms(5);
							i++;			
					}		
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xE0; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferG[i+32]=tmp>>8;
    					NT37350_bufferG[1+i+32]=tmp;
							delay_ms(5);
							i++;			
					}	
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0006); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xE1; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<6;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
						tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferG[i+48]=tmp>>8;
    					NT37350_bufferG[1+i+48]=tmp;
							delay_ms(5);
							i++;			
					}	
					//B
					SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data|0x0080);
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xE2; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
					    tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferB[i]=tmp>>8;
    					NT37350_bufferB[1+i]=tmp;
							delay_ms(5);
							i++;			
					}		
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xE3; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferB[i+16]=tmp>>8;
    					NT37350_bufferB[1+i+16]=tmp;
							delay_ms(5);
							i++;			
					}		
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xE4; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferB[i+32]=tmp>>8;
    					NT37350_bufferB[1+i+32]=tmp;
							delay_ms(5);
							i++;			
					}	
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0006); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xE5; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<6;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferB[i+48]=tmp>>8;
    					NT37350_bufferB[1+i+48]=tmp;
							delay_ms(5);
							i++;			
					}	
					
					
				}
			else if((buffer[3])==0x15)    //idle
				{
					
					//R
					SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data|0x0080);
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xE8; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferR[i]=tmp>>8;
    					NT37350_bufferR[1+i]=tmp;
							delay_ms(5);
							i++;			
					}		
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xE9; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferR[i+16]=tmp>>8;
    					NT37350_bufferR[1+i+16]=tmp;
							delay_ms(5);
							i++;			
					}		
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xEA; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
								tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferR[i+32]=tmp>>8;
    					NT37350_bufferR[1+i+32]=tmp;
							delay_ms(5);
							i++;			
					}	
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0006); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xEB; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<6;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
								tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferR[i+48]=tmp>>8;
    					NT37350_bufferR[1+i+48]=tmp;
							delay_ms(5);
							i++;			
					}	
					
					//G
					SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data|0x0080);
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xEC; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferG[i]=tmp>>8;
    					NT37350_bufferG[1+i]=tmp;
							delay_ms(5);
							i++;			
					}		
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xED; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferG[16+i]=tmp>>8;
    					NT37350_bufferG[1+i+16]=tmp;
							delay_ms(5);
							i++;			
					}		
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xEE; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferG[i+32]=tmp>>8;
    					NT37350_bufferG[1+i+32]=tmp;
							delay_ms(5);
							i++;			
					}	
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0006); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xEF; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<6;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
						tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferG[i+48]=tmp>>8;
    					NT37350_bufferG[1+i+48]=tmp;
							delay_ms(5);
							i++;			
					}	
					//B
					SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data|0x0080);
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xF0; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
					    tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferB[i]=tmp>>8;
    					NT37350_bufferB[1+i]=tmp;
							delay_ms(5);
							i++;			
					}		
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xF1; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferB[i+16]=tmp>>8;
    					NT37350_bufferB[1+i+16]=tmp;
							delay_ms(5);
							i++;			
					}		
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xF2; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferB[i+32]=tmp>>8;
    					NT37350_bufferB[1+i+32]=tmp;
							delay_ms(5);
							i++;			
					}	
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0006); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xF3; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<6;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferB[i+48]=tmp>>8;
    					NT37350_bufferB[1+i+48]=tmp;
							delay_ms(5);
							i++;			
					}	
					
				}

		  for(int j=0;j<54;j++)    
				{
         buffer[3+j]=NT37350_bufferR[j];
			   buffer[3+54+j]=NT37350_bufferG[j];
				 buffer[3+54+54+j]=NT37350_bufferB[j];

				}				
			buffer[0]=0x72;	//NT37350
			buffer[1]=0x09;
			buffer[2]=0xA2;
			delay_ms(15);
			STM2PC(pdev,CDC_IN_EP,buffer,buffer[2]+3);          //返回 读取的 Gamma数据  ：ok  		
			SSD2828_W_Reg(SigMode,channel,0xB7,HS_B7_Data);
			}
		else if((buffer[3]&0x20)==0x20)
			{
      if((buffer[3])==0x21)	   //gamma1
				{//R
					SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data|0x0080);
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xB2; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferR[i]=tmp>>8;
    					NT37350_bufferR[1+i]=tmp;
							delay_ms(5);
							i++;			
					}		
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x000E); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xB3; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<14;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferR[i+16]=tmp>>8;
    					NT37350_bufferR[1+i+16]=tmp;
							delay_ms(5);
							i++;			
					}		
					//G
					SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data|0x0080);
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xB6; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferG[i]=tmp>>8;
    					NT37350_bufferG[1+i]=tmp;
							delay_ms(5);
							i++;			
					}		
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x000E); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xB7; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<14;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferG[16+i]=tmp>>8;
    					NT37350_bufferG[1+i+16]=tmp;
							delay_ms(5);
							i++;			
					}		
					
					//B
					SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data|0x0080);
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xBA; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
					    tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferB[i]=tmp>>8;
    					NT37350_bufferB[1+i]=tmp;
							delay_ms(5);
							i++;			
					}		
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x000E); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xBB; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<14;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferB[i+16]=tmp>>8;
    					NT37350_bufferB[1+i+16]=tmp;
							delay_ms(5);
							i++;			
					}		
				
				}

			else if((buffer[3])==0x22)	   //gamma2
				{//R
					SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data|0x0080);
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xBF; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferR[i]=tmp>>8;
    					NT37350_bufferR[1+i]=tmp;
							delay_ms(5);
							i++;			
					}		
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x000E); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xC0; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<14;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferR[i+16]=tmp>>8;
    					NT37350_bufferR[1+i+16]=tmp;
							delay_ms(5);
							i++;			
					}		
					
					
					//G
					SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data|0x0080);
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xC3; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferG[i]=tmp>>8;
    					NT37350_bufferG[1+i]=tmp;
							delay_ms(5);
							i++;			
					}		
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x000E); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xC4; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<14;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferG[16+i]=tmp>>8;
    					NT37350_bufferG[1+i+16]=tmp;
							delay_ms(5);
							i++;			
					}		
				
					//B
					SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data|0x0080);
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xC7; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
					    tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferB[i]=tmp>>8;
    					NT37350_bufferB[1+i]=tmp;
							delay_ms(5);
							i++;			
					}		
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x000E); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xC8; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<14;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferB[i+16]=tmp>>8;
    					NT37350_bufferB[1+i+16]=tmp;
							delay_ms(5);
							i++;			
					}		
				}
			

      else if((buffer[3])==0x23)	   //gamma3
				{//R
					SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data|0x0080);
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xCC; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferR[i]=tmp>>8;
    					NT37350_bufferR[1+i]=tmp;
							delay_ms(5);
							i++;			
					}		
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x000E); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xCD; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<14;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferR[i+16]=tmp>>8;
    					NT37350_bufferR[1+i+16]=tmp;
							delay_ms(5);
							i++;			
					}		
				
					
					//G
					SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data|0x0080);
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xD0; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferG[i]=tmp>>8;
    					NT37350_bufferG[1+i]=tmp;
							delay_ms(5);
							i++;			
					}		
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x000E); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xD1; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<14;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferG[16+i]=tmp>>8;
    					NT37350_bufferG[1+i+16]=tmp;
							delay_ms(5);
							i++;			
					}		
					
					//B
					SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data|0x0080);
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xD4; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
					    tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferB[i]=tmp>>8;
    					NT37350_bufferB[1+i]=tmp;
							delay_ms(5);
							i++;			
					}		
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x000E); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xD5; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<14;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferB[i+16]=tmp>>8;
    					NT37350_bufferB[1+i+16]=tmp;
							delay_ms(5);
							i++;			
					}		
					
				}
		  else if((buffer[3])==0x24)	  //HBM
				{
					//R
					SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data|0x0080);
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xDA; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferR[i]=tmp>>8;
    					NT37350_bufferR[1+i]=tmp;
							delay_ms(5);
							i++;			
					}		
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x000E); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xDB; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<14;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferR[i+16]=tmp>>8;
    					NT37350_bufferR[1+i+16]=tmp;
							delay_ms(5);
							i++;			
					}		
					
					//G
					SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data|0x0080);
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xDE; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferG[i]=tmp>>8;
    					NT37350_bufferG[1+i]=tmp;
							delay_ms(5);
							i++;			
					}		
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x000E); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xDF; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<14;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferG[16+i]=tmp>>8;
    					NT37350_bufferG[1+i+16]=tmp;
							delay_ms(5);
							i++;			
					}		
				
					//B
					SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data|0x0080);
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xE2; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
					    tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferB[i]=tmp>>8;
    					NT37350_bufferB[1+i]=tmp;
							delay_ms(5);
							i++;			
					}		
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x000E); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xE3; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<14;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferB[i+16]=tmp>>8;
    					NT37350_bufferB[1+i+16]=tmp;
							delay_ms(5);
							i++;			
					}		

				}
			else if((buffer[3])==0x25)    //idle
				{
					
					//R
					SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data|0x0080);
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xE8; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferR[i]=tmp>>8;
    					NT37350_bufferR[1+i]=tmp;
							delay_ms(5);
							i++;			
					}		
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x000E); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xE9; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<14;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferR[i+16]=tmp>>8;
    					NT37350_bufferR[1+i+16]=tmp;
							delay_ms(5);
							i++;			
					}		
				
					//G
					SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data|0x0080);
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xEC; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferG[i]=tmp>>8;
    					NT37350_bufferG[1+i]=tmp;
							delay_ms(5);
							i++;			
					}		
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x000E); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xED; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<14;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferG[16+i]=tmp>>8;
    					NT37350_bufferG[1+i+16]=tmp;
							delay_ms(5);
							i++;			
					}		
					
					//B
					SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data|0x0080);
					SSD2828_W_Reg(SigMode,channel,0xC1,0x0010); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xF0; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<16;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
					    tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferB[i]=tmp>>8;
    					NT37350_bufferB[1+i]=tmp;
							delay_ms(5);
							i++;			
					}		
					
					SSD2828_W_Reg(SigMode,channel,0xC1,0x000E); //返回个数设置	    
	        delay_ms(2);				 
		      buffer1[0] = 0x02;        
					buffer1[1] = 0xF1; 
					SSD2828_W_Array(SigMode,channel,buffer1,0);		 
					delay_ms(2);                
					SSD2828_W_Reg(SigMode,channel,0xD4,0x00FA);
					SSD2828_W_Cmd(SigMode,channel,0xFF);
					delay_ms(2);
					for(i=0;i<14;i++)
					{
							SSD2828_W_Cmd(SigMode,channel,0xFA);		
							tmp=SPI3_Read_u16_Data(channel);
							NT37350_bufferB[i+16]=tmp>>8;
    					NT37350_bufferB[1+i+16]=tmp;
							delay_ms(5);
							i++;			
					}		
				}
		  for(int j=0;j<30;j++)    
				{
					buffer[3+j]=NT37350_bufferR[j];
					buffer[3+30+j]=NT37350_bufferG[j];
					buffer[3+30+30+j]=NT37350_bufferB[j];
				}				
			buffer[0]=0x72;	//NT37350
			buffer[1]=0x09;
			buffer[2]=0x5A;
			delay_ms(15);
			STM2PC(pdev,CDC_IN_EP,buffer,buffer[2]+3);          //返回 读取的 Gamma数据  ：ok  		
			SSD2828_W_Reg(SigMode,channel,0xB7,HS_B7_Data);
			}
		}
			else  //QSPI
			{
				buffer1[0] = 0x02;        
    	  buffer1[1] = 0xff;
				buffer1[2] = 0x21;
				OSPI_Write_u8_Array(SigMode,channel ,buffer1,0);
			 if((buffer[3]&0x10)==0x10)    //27 NODE
			{
				if((buffer[3])==0x11)	   //gamma1
				{//R
					OSPI_Read_Array_Data(SigMode,channel,0xB2,tempRec, 16);
					for(i=0;i<16;i++)
					{
							NT37350_bufferR[i]=tempRec[i];
					}		
					OSPI_Read_Array_Data(SigMode,channel,0xB3,tempRec, 16);
					for(i=0;i<16;i++)
					{
							NT37350_bufferR[i+16]=tempRec[i];
					}		
					OSPI_Read_Array_Data(SigMode,channel,0xB4,tempRec, 16);
					for(i=0;i<16;i++)
					{
							NT37350_bufferR[i+32]=tempRec[i];
					}		
					OSPI_Read_Array_Data(SigMode,channel,0xB5,tempRec, 6);
					for(i=0;i<6;i++)
					{
							NT37350_bufferR[i+48]=tempRec[i];
					}	
					//G
					OSPI_Read_Array_Data(SigMode,channel,0xB6,tempRec, 16);
					for(i=0;i<16;i++)
					{
							NT37350_bufferG[i]=tempRec[i];
					}		
					OSPI_Read_Array_Data(SigMode,channel,0xB7,tempRec, 16);
					for(i=0;i<16;i++)
					{
							NT37350_bufferG[i+16]=tempRec[i];
					}		
					OSPI_Read_Array_Data(SigMode,channel,0xB8,tempRec, 16);
					for(i=0;i<16;i++)
					{
							NT37350_bufferG[i+32]=tempRec[i];
					}		
					OSPI_Read_Array_Data(SigMode,channel,0xB9,tempRec, 6);
					for(i=0;i<6;i++)
					{
							NT37350_bufferG[i+48]=tempRec[i];
					}					
					//B
					OSPI_Read_Array_Data(SigMode,channel,0xBA,tempRec, 16);
					for(i=0;i<16;i++)
					{
							NT37350_bufferB[i]=tempRec[i];
					}		
					OSPI_Read_Array_Data(SigMode,channel,0xBB,tempRec, 16);
					for(i=0;i<16;i++)
					{
							NT37350_bufferB[i+16]=tempRec[i];
					}		
					OSPI_Read_Array_Data(SigMode,channel,0xBC,tempRec, 16);
					for(i=0;i<16;i++)
					{
							NT37350_bufferB[i+32]=tempRec[i];
					}		
					OSPI_Read_Array_Data(SigMode,channel,0xBD,tempRec, 6);
					for(i=0;i<6;i++)
					{
							NT37350_bufferB[i+48]=tempRec[i];
					}		
					
				}

				else if((buffer[3])==0x12)	   //gamma2
					{
						//R
						OSPI_Read_Array_Data(SigMode,channel,0xBF,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferR[i]=tempRec[i];
						}		
						OSPI_Read_Array_Data(SigMode,channel,0xC0,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferR[i+16]=tempRec[i];
						}		
						OSPI_Read_Array_Data(SigMode,channel,0xC1,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferR[i+32]=tempRec[i];
						}		
						OSPI_Read_Array_Data(SigMode,channel,0xC2,tempRec, 6);
						for(i=0;i<6;i++)
						{
								NT37350_bufferR[i+48]=tempRec[i];
						}	
						//G
						OSPI_Read_Array_Data(SigMode,channel,0xC3,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferG[i]=tempRec[i];
						}		
						OSPI_Read_Array_Data(SigMode,channel,0xC4,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferG[i+16]=tempRec[i];
						}		
						OSPI_Read_Array_Data(SigMode,channel,0xC5,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferG[i+32]=tempRec[i];
						}		
						OSPI_Read_Array_Data(SigMode,channel,0xC6,tempRec, 6);
						for(i=0;i<6;i++)
						{
								NT37350_bufferG[i+48]=tempRec[i];
						}					
						//B
						OSPI_Read_Array_Data(SigMode,channel,0xC7,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferB[i]=tempRec[i];
						}		
						OSPI_Read_Array_Data(SigMode,channel,0xC8,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferB[i+16]=tempRec[i];
						}		
						OSPI_Read_Array_Data(SigMode,channel,0xC9,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferB[i+32]=tempRec[i];
						}		
						OSPI_Read_Array_Data(SigMode,channel,0xCA,tempRec, 6);
						for(i=0;i<6;i++)
						{
								NT37350_bufferB[i+48]=tempRec[i];
						}		
					}
				

				else if((buffer[3])==0x13)	   //gamma3
					{
						//R
						OSPI_Read_Array_Data(SigMode,channel,0xCC,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferR[i]=tempRec[i];
						}		
						OSPI_Read_Array_Data(SigMode,channel,0xCD,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferR[i+16]=tempRec[i];
						}		
						OSPI_Read_Array_Data(SigMode,channel,0xCE,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferR[i+32]=tempRec[i];
						}		
						OSPI_Read_Array_Data(SigMode,channel,0xCF,tempRec, 6);
						for(i=0;i<6;i++)
						{
								NT37350_bufferR[i+48]=tempRec[i];
						}	
						//G
						OSPI_Read_Array_Data(SigMode,channel,0xD0,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferG[i]=tempRec[i];
						}		
						OSPI_Read_Array_Data(SigMode,channel,0xD1,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferG[i+16]=tempRec[i];
						}		
						OSPI_Read_Array_Data(SigMode,channel,0xD2,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferG[i+32]=tempRec[i];
						}		
						OSPI_Read_Array_Data(SigMode,channel,0xD3,tempRec, 6);
						for(i=0;i<6;i++)
						{
								NT37350_bufferG[i+48]=tempRec[i];
						}					
						//B
						OSPI_Read_Array_Data(SigMode,channel,0xD4,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferB[i]=tempRec[i];
						}		
						OSPI_Read_Array_Data(SigMode,channel,0xD5,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferB[i+16]=tempRec[i];
						}		
						OSPI_Read_Array_Data(SigMode,channel,0xD6,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferB[i+32]=tempRec[i];
						}		
						OSPI_Read_Array_Data(SigMode,channel,0xD7,tempRec, 6);
						for(i=0;i<6;i++)
						{
								NT37350_bufferB[i+48]=tempRec[i];
						}		
						
					}
				else if((buffer[3])==0x14)	  //HBM
					{
						//R
						OSPI_Read_Array_Data(SigMode,channel,0xDA,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferR[i]=tempRec[i];
						}		
						OSPI_Read_Array_Data(SigMode,channel,0xDB,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferR[i+16]=tempRec[i];
						}		
						OSPI_Read_Array_Data(SigMode,channel,0xDC,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferR[i+32]=tempRec[i];
						}		
						OSPI_Read_Array_Data(SigMode,channel,0xDD,tempRec, 6);
						for(i=0;i<6;i++)
						{
								NT37350_bufferR[i+48]=tempRec[i];
						}	
						//G
						OSPI_Read_Array_Data(SigMode,channel,0xDE,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferG[i]=tempRec[i];
						}		
						OSPI_Read_Array_Data(SigMode,channel,0xDF,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferG[i+16]=tempRec[i];
						}		
						OSPI_Read_Array_Data(SigMode,channel,0xE0,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferG[i+32]=tempRec[i];
						}		
						OSPI_Read_Array_Data(SigMode,channel,0xE1,tempRec, 6);
						for(i=0;i<6;i++)
						{
								NT37350_bufferG[i+48]=tempRec[i];
						}					
						//B
						OSPI_Read_Array_Data(SigMode,channel,0xE2,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferB[i]=tempRec[i];
						}		
						OSPI_Read_Array_Data(SigMode,channel,0xE3,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferB[i+16]=tempRec[i];
						}		
						OSPI_Read_Array_Data(SigMode,channel,0xE4,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferB[i+32]=tempRec[i];
						}		
						OSPI_Read_Array_Data(SigMode,channel,0xE5,tempRec, 6);
						for(i=0;i<6;i++)
						{
								NT37350_bufferB[i+48]=tempRec[i];
						}		
					}
				else if((buffer[3])==0x15)    //idle
					{
						
					//R
						OSPI_Read_Array_Data(SigMode,channel,0xE8,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferR[i]=tempRec[i];
						}		
						OSPI_Read_Array_Data(SigMode,channel,0xE9,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferR[i+16]=tempRec[i];
						}		
						OSPI_Read_Array_Data(SigMode,channel,0xEA,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferR[i+32]=tempRec[i];
						}		
						OSPI_Read_Array_Data(SigMode,channel,0xEB,tempRec, 6);
						for(i=0;i<6;i++)
						{
								NT37350_bufferR[i+48]=tempRec[i];
						}	
						//G
						OSPI_Read_Array_Data(SigMode,channel,0xEC,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferG[i]=tempRec[i];
						}		
						OSPI_Read_Array_Data(SigMode,channel,0xED,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferG[i+16]=tempRec[i];
						}		
						OSPI_Read_Array_Data(SigMode,channel,0xEE,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferG[i+32]=tempRec[i];
						}		
						OSPI_Read_Array_Data(SigMode,channel,0xEF,tempRec, 6);
						for(i=0;i<6;i++)
						{
								NT37350_bufferG[i+48]=tempRec[i];
						}					
						//B
						OSPI_Read_Array_Data(SigMode,channel,0xF0,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferB[i]=tempRec[i];
						}		
						OSPI_Read_Array_Data(SigMode,channel,0xF1,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferB[i+16]=tempRec[i];
						}		
						OSPI_Read_Array_Data(SigMode,channel,0xF2,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferB[i+32]=tempRec[i];
						}		
						OSPI_Read_Array_Data(SigMode,channel,0xF3,tempRec, 6);
						for(i=0;i<6;i++)
						{
								NT37350_bufferB[i+48]=tempRec[i];
						}			
					}

				for(int j=0;j<54;j++)    
					{
					 buffer[3+j]=NT37350_bufferR[j];
					 buffer[3+54+j]=NT37350_bufferG[j];
					 buffer[3+54+54+j]=NT37350_bufferB[j];

					}				
					buffer[0]=0x72;	//NT37350
					buffer[1]=0x09;
					buffer[2]=0xA2;
					delay_ms(15);
					STM2PC(pdev,CDC_IN_EP,buffer,buffer[2]+3);          //返回 读取的 Gamma数据  ：ok  		
					SSD2828_W_Reg(SigMode,channel,0xB7,HS_B7_Data);
			}
			else if((buffer[3]&0x20)==0x20)   //15 NODE
			{
				if((buffer[3])==0x21)	   //gamma1
					{//R
						OSPI_Read_Array_Data(SigMode,channel,0xB2,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferR[i]=tempRec[i];
						}	
						OSPI_Read_Array_Data(SigMode,channel,0xB3,tempRec, 14);
						for(i=0;i<14;i++)
						{
								NT37350_bufferR[i+16]=tempRec[i];
						}	
						//G
						OSPI_Read_Array_Data(SigMode,channel,0xB6,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferG[i]=tempRec[i];
						}	
						OSPI_Read_Array_Data(SigMode,channel,0xB7,tempRec, 14);
						for(i=0;i<14;i++)
						{
								NT37350_bufferG[i+16]=tempRec[i];
						}		
						
						//B
						OSPI_Read_Array_Data(SigMode,channel,0xBA,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferB[i]=tempRec[i];
						}	
						OSPI_Read_Array_Data(SigMode,channel,0xBB,tempRec, 14);
						for(i=0;i<14;i++)
						{
								NT37350_bufferB[i+16]=tempRec[i];
						}	
					}

				else if((buffer[3])==0x22)	   //gamma2
					{
						
						OSPI_Read_Array_Data(SigMode,channel,0xBF,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferR[i]=tempRec[i];
						}	
						OSPI_Read_Array_Data(SigMode,channel,0xC0,tempRec, 14);
						for(i=0;i<14;i++)
						{
								NT37350_bufferR[i+16]=tempRec[i];
						}	
						//G
						OSPI_Read_Array_Data(SigMode,channel,0xC3,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferG[i]=tempRec[i];
						}	
						OSPI_Read_Array_Data(SigMode,channel,0xC4,tempRec, 14);
						for(i=0;i<14;i++)
						{
								NT37350_bufferG[i+16]=tempRec[i];
						}		
						
						//B
						OSPI_Read_Array_Data(SigMode,channel,0xC7,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferB[i]=tempRec[i];
						}	
						OSPI_Read_Array_Data(SigMode,channel,0xC8,tempRec, 14);
						for(i=0;i<14;i++)
						{
								NT37350_bufferB[i+16]=tempRec[i];
						}	
					}
				

				else if((buffer[3])==0x23)	   //gamma3
					{//R
						OSPI_Read_Array_Data(SigMode,channel,0xCC,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferR[i]=tempRec[i];
						}	
						OSPI_Read_Array_Data(SigMode,channel,0xCD,tempRec, 14);
						for(i=0;i<14;i++)
						{
								NT37350_bufferR[i+16]=tempRec[i];
						}	
						//G
						OSPI_Read_Array_Data(SigMode,channel,0xD0,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferG[i]=tempRec[i];
						}	
						OSPI_Read_Array_Data(SigMode,channel,0xD1,tempRec, 14);
						for(i=0;i<14;i++)
						{
								NT37350_bufferG[i+16]=tempRec[i];
						}		
						
						//B
						OSPI_Read_Array_Data(SigMode,channel,0xD4,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferB[i]=tempRec[i];
						}	
						OSPI_Read_Array_Data(SigMode,channel,0xD5,tempRec, 14);
						for(i=0;i<14;i++)
						{
								NT37350_bufferB[i+16]=tempRec[i];
						}	
					}
				else if((buffer[3])==0x24)	  //HBM
					{
						//R
						OSPI_Read_Array_Data(SigMode,channel,0xDA,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferR[i]=tempRec[i];
						}	
						OSPI_Read_Array_Data(SigMode,channel,0xDB,tempRec, 14);
						for(i=0;i<14;i++)
						{
								NT37350_bufferR[i+16]=tempRec[i];
						}	
						//G
						OSPI_Read_Array_Data(SigMode,channel,0xDE,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferG[i]=tempRec[i];
						}	
						OSPI_Read_Array_Data(SigMode,channel,0xDF,tempRec, 14);
						for(i=0;i<14;i++)
						{
								NT37350_bufferG[i+16]=tempRec[i];
						}		
						
						//B
						OSPI_Read_Array_Data(SigMode,channel,0xE2,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferB[i]=tempRec[i];
						}	
						OSPI_Read_Array_Data(SigMode,channel,0xE3,tempRec, 14);
						for(i=0;i<14;i++)
						{
								NT37350_bufferB[i+16]=tempRec[i];
						}	
					}
				else if((buffer[3])==0x25)    //idle
					{
						//R
						OSPI_Read_Array_Data(SigMode,channel,0xE8,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferR[i]=tempRec[i];
						}	
						OSPI_Read_Array_Data(SigMode,channel,0xE9,tempRec, 14);
						for(i=0;i<14;i++)
						{
								NT37350_bufferR[i+16]=tempRec[i];
						}	
						//G
						OSPI_Read_Array_Data(SigMode,channel,0xEC,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferG[i]=tempRec[i];
						}	
						OSPI_Read_Array_Data(SigMode,channel,0xED,tempRec, 14);
						for(i=0;i<14;i++)
						{
								NT37350_bufferG[i+16]=tempRec[i];
						}		
						
						//B
						OSPI_Read_Array_Data(SigMode,channel,0xF0,tempRec, 16);
						for(i=0;i<16;i++)
						{
								NT37350_bufferB[i]=tempRec[i];
						}	
						OSPI_Read_Array_Data(SigMode,channel,0xF1,tempRec, 14);
						for(i=0;i<14;i++)
						{
								NT37350_bufferB[i+16]=tempRec[i];
						}	
					}
				for(int j=0;j<30;j++)    
					{
					 buffer[3+j]=NT37350_bufferR[j];
					 buffer[3+30+j]=NT37350_bufferG[j];
					 buffer[3+30+30+j]=NT37350_bufferB[j];
					}				
				buffer[0]=0x72;	//NT37350
				buffer[1]=0x09;
				buffer[2]=0x5A;
				delay_ms(15);
				STM2PC(pdev,CDC_IN_EP,buffer,buffer[2]+3);          //返回 读取的 Gamma数据  ：ok  		
				SSD2828_W_Reg(SigMode,channel,0xB7,HS_B7_Data);
			}
		}
}


void NT37350_Inter_BIST(USBD_HandleTypeDef *pdev,uint8_t  ep_addr,u8 SigMode ,u8 channel,u8* buffer,u16 LP_B7_Data,u16 HS_B7_Data)
{	

}

void NT37350_Write_Register(USBD_HandleTypeDef *pdev,uint8_t  ep_addr,u8 SigMode ,u8 channel,u8* buffer,u16 LP_B7_Data,u16 HS_B7_Data)
{

}
void NT37350_Read_Register(USBD_HandleTypeDef *pdev,uint8_t  ep_addr,u8 SigMode ,u8 channel,u8* buffer,u16 LP_B7_Data,u16 HS_B7_Data)
{
 
}


//write  gamma
void NT37350_Write_Gamma(USBD_HandleTypeDef *pdev,uint8_t  ep_addr,u8 SigMode ,u8 channel,u8* buffer,u16 LP_B7_Data,u16 HS_B7_Data)
{
	u8 buffer1[20];
	SSD2828_W_Reg(SigMode,channel,0xB7,LP_B7_Data);
    delay_ms(10);
	if(buffer[3] == 0x01)    //27 point
	{
	  {
		  //----------------------------R---------------------------
		 buffer1[0] = 17;
		 for(int i=0;i<17;i++)                     //0xB2       BF
		 {
			  buffer1[i+1] = buffer[i+4];
		 }
	     SSD2828_W_Array(SigMode,channel,buffer1,0);	
		 
		 for(int i=0;i<17;i++)                    //0xB3          C0
		 {
			  buffer1[i+1] = buffer[i+4+18];
		 }
	     SSD2828_W_Array(SigMode,channel,buffer1,0);	
		 
		 for(int i=0;i<17;i++)                    //0xB4         C1
		 {
			  buffer1[i+1] = buffer[i+4+18*2];
		 }
	     SSD2828_W_Array(SigMode,channel,buffer1,0);	
		 
		 buffer1[0] = 7;
		 for(int i=0;i<7;i++)                    //0xB5          C2
		 {
			  buffer1[i+1] = buffer[i+4+18*3];
		 }
	     SSD2828_W_Array(SigMode,channel,buffer1,0);
		 
		 //----------------------------G---------------------------
		 buffer1[0] = 17;
		 for(int i=0;i<17;i++)                     //0xB6      C3
		 {
			  buffer1[i+1] = buffer[i+4+18*3+8];
		 }
	     SSD2828_W_Array(SigMode,channel,buffer1,0);	
		 
		 for(int i=0;i<17;i++)                    //0xB7      C4
		 {
			  buffer1[i+1] = buffer[i+4+18*4+8];
		 }
	     SSD2828_W_Array(SigMode,channel,buffer1,0);	
		 
		 for(int i=0;i<17;i++)                    //0xB8       C5
		 {
			  buffer1[i+1] = buffer[i+4+18*5+8];
		 }
	     SSD2828_W_Array(SigMode,channel,buffer1,0);	
		 
		 buffer1[0] = 7;
		 for(int i=0;i<7;i++)                    //0xB9      C6
		 {
			  buffer1[i+1] = buffer[i+4+18*6+8];
		 }
	     SSD2828_W_Array(SigMode,channel,buffer1,0);
		 
		 //----------------------------B---------------------------
		 buffer1[0] = 17;
		 for(int i=0;i<17;i++)                     //0xBA       C7
		 {
			  buffer1[i+1] = buffer[i+4+18*6+8*2];
		 }
	     SSD2828_W_Array(SigMode,channel,buffer1,0);	
		 
		 for(int i=0;i<17;i++)                    //0xBB       C8
		 {
			  buffer1[i+1] = buffer[i+4+18*7+8*2];
		 }
	     SSD2828_W_Array(SigMode,channel,buffer1,0);	
		 
		 for(int i=0;i<17;i++)                    //0xBC     C9
		 {
			  buffer1[i+1] = buffer[i+4+18*8+8*2];
		 }
	     SSD2828_W_Array(SigMode,channel,buffer1,0);	
		 
		 buffer1[0] = 7;
		 for(int i=0;i<7;i++)                    //0xBD    CA
		 {
			  buffer1[i+1] = buffer[i+4+18*9+8*2];
		 }
	     SSD2828_W_Array(SigMode,channel,buffer1,0);
	  }
	}
	else if(buffer[3] == 0x02)   //15point
	{
	      	  {
		  //----------------------------R---------------------------
		 buffer1[0] = 17;
		 for(int i=0;i<17;i++)                     //0xB2       BF
		 {
			  buffer1[i+1] = buffer[i+4];
		 }
	     SSD2828_W_Array(SigMode,channel,buffer1,0);	
		 
		 buffer1[0] = 15;
		 for(int i=0;i<15;i++)                    //0xB3          C0
		 {
			  buffer1[i+1] = buffer[i+4+18];
		 }
	     SSD2828_W_Array(SigMode,channel,buffer1,0);	
		 
		 
		 //----------------------------G---------------------------
		 buffer1[0] = 17;
		 for(int i=0;i<17;i++)                     //0xB6      C3
		 {
			  buffer1[i+1] = buffer[i+4+18+16];
		 }
	     SSD2828_W_Array(SigMode,channel,buffer1,0);	
		 
		 buffer1[0] = 15;
		 for(int i=0;i<15;i++)                    //0xB7      C4
		 {
			  buffer1[i+1] = buffer[i+4+18*2+16];
		 }
	     SSD2828_W_Array(SigMode,channel,buffer1,0);	
		 

		 
		 //----------------------------B---------------------------
		 buffer1[0] = 17;
		 for(int i=0;i<17;i++)                     //0xBA       C7
		 {
			  buffer1[i+1] = buffer[i+4+18*2+16*2];
		 }
	     SSD2828_W_Array(SigMode,channel,buffer1,0);	
		 
		 
		 buffer1[0] = 15;
		 for(int i=0;i<15;i++)                    //0xBB       C8
		 {
			  buffer1[i+1] = buffer[i+4+18*3+16*2];
		 }
	     SSD2828_W_Array(SigMode,channel,buffer1,0);	
		 
	  }
	}
	
	SSD2828_W_Reg(SigMode,channel,0xB7,HS_B7_Data);
    buffer[4] = Uart_Error_None;
    STM2PC(pdev,CDC_IN_EP,buffer,buffer[2]+3);           //返回 写Gamma状态  ：ok  
   
}

void NT37350_Gamma_Update(USBD_HandleTypeDef *pdev,uint8_t  ep_addr,u8 SigMode ,u8 channel,u8* buffer,u16 LP_B7_Data,u16 HS_B7_Data)
{
  
}


void NT37350_Gamma_OTP_Start(USBD_HandleTypeDef *pdev,uint8_t  ep_addr,u8 SigMode ,u8 channel,u8* buffer,u16 LP_B7_Data,u16 HS_B7_Data)
{
}

void NT37350_Erase_Flash(USBD_HandleTypeDef *pdev,uint8_t  ep_addr,u8 SigMode ,u8 channel,u8* buffer,u16 LP_B7_Data,u16 HS_B7_Data)
{
	
}

void NT37350_Program_Flash_Set(USBD_HandleTypeDef *pdev,uint8_t  ep_addr,u8 SigMode ,u8 channel,u8* buffer,u16 LP_B7_Data,u16 HS_B7_Data)
{
	
}

void NT37350_Program_Flash_Load(USBD_HandleTypeDef *pdev,uint8_t  ep_addr,u8 SigMode ,u8 channel,u8* buffer,u16 LP_B7_Data,u16 HS_B7_Data)
{	
		
}


void NT37350_Show(USBD_HandleTypeDef *pdev,uint8_t  ep_addr,u8 SigMode ,u8 channel,u8* buffer,u16 LP_B7_Data,u16 HS_B7_Data)
{
	
}


void ProcessForIc72( USBD_HandleTypeDef *pdev,uint8_t  ep_addr,u8 SigMode ,u8 channel,u8 buffer[],u16 LP_B7_Data,u16 HS_B7_Data)
{	
	switch(buffer[1])
	{
//    case 0x01:                                      //写寄存器
//         NT37350_Write_Register(pdev,ep_addr,SigMode,channel,buffer,LP_B7_Data,HS_B7_Data);break;	
//    case 0x02:                                      //读寄存器
//         NT37350_Read_Register(pdev,ep_addr,SigMode,channel,buffer,LP_B7_Data,HS_B7_Data);break;	
//    case 0x03:                                      //自动gamma写
//         NT37350_Gamma_Update(pdev,ep_addr,SigMode,channel,buffer,LP_B7_Data,HS_B7_Data);break;			
    case 0x08:                                      //写Gamma数据    
         NT37350_Write_Gamma(pdev,ep_addr,SigMode,channel,buffer,LP_B7_Data,HS_B7_Data);break;
    case 0x09:                                      //读Gamma数据
         NT37350_Read_Gamma(pdev,ep_addr,SigMode,channel,buffer,LP_B7_Data,HS_B7_Data);break; 
//		case 0x0D://OTP Gamma
//         NT37350_Gamma_OTP_Start(pdev,ep_addr,SigMode,channel,buffer,LP_B7_Data,HS_B7_Data);  break;

    default:	break;	
	}	
}


